<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Spring Boot Thymeleaf + Spring Security</title>

    <div th:replace="fragments/header :: header-css"/>

</head>
<body>

<div th:replace="fragments/header :: header"/>

<div class="container">

    <div class="starter-template">
        <h1>Spring Boot Web Thymeleaf + Spring Security</h1>
        <h2>1. Visit <a th:href="@{/admin}">Admin page (Spring Security protected, Need Admin Role)</a></h2>
        <h2>2. Visit <a th:href="@{/user}">User page (Spring Security protected, Need User Role)</a></h2>
        <h2>3. Visit <a th:href="@{/about}">Normal page</a></h2>

        <br><br><br>

        <br>
        <div sec:authorize="isAuthenticated()">
            <p>已登录</p>
            <p>登录名：<span sec:authentication="name"></span></p>
            <p>角色：<span sec:authentication="principal.authorities"></span></p>
            <p>Username：<span sec:authentication="principal.username"></span></p>
            <p>Password：<span sec:authentication="principal.password"></span></p>
        </div>
        <h3 sec:authorize="hasRole('ROLE_ADMIN')">这是 Admin 角色可以看到的内容</h3>
        <h3 sec:authorize="hasRole('ROLE_USER')">这是 User 角色可以看到的内容</h3>
    </div>

</div>
<!-- /.container -->

<div th:replace="fragments/footer :: footer"/>

</body>
</html>